package com.kl.modular.system.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.kl.common.util.StringUtil;
import com.kl.modular.base.service.impl.BaseServiceImpl;
import com.kl.modular.system.dao.mapper.SystemDicTypeMapper;
import com.kl.modular.system.dao.model.SystemDicType;
import com.kl.modular.system.service.api.ISystemDicTypeService;
import com.kl.modular.system.service.bo.SystemDicTypeBo;
import org.springframework.stereotype.Service;

/**
 *
 * 应用信息回调地址实现类
 *
 * @author xr_zjb
 * @date 2017/07/03 1:23
 *
 *
 */
@Service
public class SystemDicTypeServiceImpl extends BaseServiceImpl<SystemDicTypeMapper, SystemDicType> implements ISystemDicTypeService {

    /**
     * 模糊查询数据字典类型(字典类型名称模糊，类型code)
     * @param page 分页数据
     * @param systemDicTypeBo 数据对象BO类
     * @return
     */
    public Page<SystemDicType> selectPageBySystemDicTypeBo(Page<SystemDicType> page, SystemDicTypeBo systemDicTypeBo) {
        if(page == null)page = new Page<SystemDicType>();
        if(systemDicTypeBo == null)return page;
        Wrapper<SystemDicType> wrapper = new EntityWrapper<SystemDicType>();
        if (!StringUtil.StringIsNullOrEmpty(systemDicTypeBo.getName())) {
            wrapper.like("name", systemDicTypeBo.getName());
        }
        if (!StringUtil.StringIsNullOrEmpty(systemDicTypeBo.getTypeCode())) {
            wrapper.eq("type_code", systemDicTypeBo.getTypeCode());
        }
        page = selectPage(page, wrapper);
        return page;
    }
}
